package com.top75;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

/**
 * @Author: huangzhigao
 * @Date: 2023/5/14 20:08
 */
public class Code2215 {
    public List<List<Integer>> findDifference(int[] nums1, int[] nums2) {
        HashSet<Integer> set1 = new HashSet<>();
        HashSet<Integer> set2 = new HashSet<>();
        List<List<Integer>> res = new ArrayList<>();
        List<Integer> res1 = new ArrayList<>();
        List<Integer> res2 = new ArrayList<>();
        res.add(res1);
        res.add(res2);
        for (int i : nums1) {
            set1.add(i);
        }
        for (int i : nums2) {
            set2.add(i);
        }

        set1.forEach(i -> {
            if (!set2.contains(i)) {
                res1.add(i);
            }
        });
        set2.forEach(i -> {
            if (!set1.contains(i)) {
                res2.add(i);
            }
        });
        return res;
    }
}
